//
//  ViewController.m
//  TestForBlock
//
//  Created by 伍银荣 on 2021/7/8.
//  Copyright © 2021 com.WYR. All rights reserved.
//

#import "ViewController.h"
#import "SecondViewController.h"

@interface ViewController ()
@property (strong, nonatomic) IBOutlet UITextField *textField;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"viewcontroller";
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    SecondViewController *svc = [SecondViewController new];
    svc.vc = self;
    [self presentViewController:svc animated:YES completion:^{
        NSLog(@"textfield = %@",self.textField.text);
        if (self.textFieldBlock) {
            self.textFieldBlock(self.textField.text);
        }
    }];
}


@end
